﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WinFormsApp1.Common;

namespace WinFormsApp1.TongShiWei
{
    public partial class AddPRQSData : UIForm
    {
        public AddPRQSData()
        {
            InitializeComponent();
        }

        private async void AddPRQSButton_Click(object sender, EventArgs e)
        {
            PRQSData data = new PRQSData()
            {
                CreateName = "张三",
                CreateTime = DateTime.Now,
                PRQSName = PRQSName.Text,
                PRQSindex = PRQSIndex.Text,
                Require = Require.Text,
                FinallyName = "张三"
            };
            //http://localhost:5159/api/TSW/AddPRQSData
            var res = await HttpClientHelper.RequestUrl<PRQSData, ApiResult<PRQSData>>(URLCommon.Url1, "/TSW/AddPRQSData", HttpClientHelper.MethodType.POST, data);
            if (res.Code > 0)
            {
                MessageBox.Show("添加成功");
                this.Hide();
            }
            else
            {
                MessageBox.Show("添加失败");
                this.Hide();
            }
        }
        public class PRQSData
        {
            /// <summary>
            /// 检疫项目Id
            /// </summary>
            public int PRQSId { get; set; }
            /// <summary>
            /// 检疫项目名称
            /// </summary>
            public string PRQSName { get; set; } = string.Empty;
            /// <summary>
            /// 检疫指标
            /// </summary>
            public string PRQSindex { get; set; } = string.Empty;
            /// <summary>
            /// 标准要求
            /// </summary>
            public string Require { get; set; } = string.Empty;
            /// <summary>
            /// 启用状态
            /// </summary>
            public bool PRQSstate { get; set; } = false;
            /// <summary>
            /// 创建人
            /// </summary>
            public string CreateName { get; set; } = string.Empty;
            /// <summary>
            /// 创建时间
            /// </summary>
            public DateTime CreateTime { get; set; } = DateTime.Now;
            /// <summary>
            /// 最后修改人
            /// </summary>
            public string FinallyName { get; set; } = string.Empty;
            /// <summary>
            /// 最后修改时间
            /// </summary>
            public DateTime FinallyTime { get; set; } = DateTime.Now;
            /// <summary>
            /// 是否禁用
            /// </summary>
            public bool IsPRQS { get; set; } = false;
            /// <summary>
            /// 是否删除
            /// </summary>
            public bool ISDeletePRQS { get; set; } = false;
        }
    }
}
